<?php
namespace app\app\model;
use think\Model;
class Course extends Model
{
    public function getCourse()
    {
        $course_modules = db('coursemodules')->field(['id','course_module'])->select();
        if ($course_modules == false){
            return false;
        }
        $result = array();
        foreach ($course_modules as $cm => $cmv){
            $res_tmp = array();
            $res_tmp['id'] = $cmv['id'];
            $res_tmp['course_module'] = $cmv['course_module'];
            $res_tmp['course'] = $course = db('course')->field(['id','course','parent_id'])->where('parent_id',$cmv['id'])->select();
            array_push($result, $res_tmp);
        }
        return $result;
    }
    
   
}